# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=jdcal
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=1.2
pkgrel=2
pkgdesc="Julian dates, from proleptic Gregorian and Julian calendars (mingw-w64)"
url="https://github.com/phn/jdcal"
arch=('any')
license=('BSD')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
)
source=("https://pypi.python.org/packages/source/j/jdcal/jdcal-${pkgver}.tar.gz")
sha256sums=('5ebedb58b95ebabd30f56abef65139c6f69ec1687cf1d2f3a7c503f9a2cdfa4d')


prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

package_python3-jdcal() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python3"
  )

  cd ${srcdir}/${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-jdcal() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python2"
  )

  cd ${srcdir}/${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-jdcal() {
  package_python2-jdcal
}

package_mingw-w64-i686-python3-jdcal() {
  package_python3-jdcal
}

package_mingw-w64-x86_64-python2-jdcal() {
  package_python2-jdcal
}

package_mingw-w64-x86_64-python3-jdcal() {
  package_python3-jdcal
}

# vim:set ts=2 sw=2 et:
